package com.ftg.learn.chapter15.proxy;

/**
 * @author KangJx
 * @date 2021/7/28
 */
public class Singer implements ISinger {

    private String name;

    public Singer(String name) {
        this.name = name;
    }


    @Override
    public void singSong(String name) {
        System.out.println("我是" + this.name);
        System.out.println("给大家带一首" + name);
    }


    public static void main(String[] args) {
        int k;
        int minn = 102;
        int minpos = 0;
        for (k = 1; k < 100; k++) {
            int temp;
            if (100 % k == 0) {
                temp = k + 100 / k;
            } else {
                temp = k + 100 / k + 1;
            }
            if (temp < minn) {
                minn = temp;
                minpos = k;
                System.out.printf("共有几组%d\n", minpos);
                System.out.printf("检测多少次%d\n", temp);
            }
        }

    }
}